/**
 * Copyright &copy; 2019-2022 <a href="https://gitee.com/rit/zx-pm">zx-pm</a> All rights reserved.
 */
package com.zx.pm.modules.zx.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zx.pm.common.service.TreeService;
import com.zx.pm.modules.zx.dao.CgmlDao;
import com.zx.pm.modules.zx.entity.Cgml;

/**
 * 采购目录Service
 * @author forest
 * @version 2019-01-04
 */
@Service
@Transactional(readOnly = true)
public class CgmlService extends TreeService<CgmlDao, Cgml> {

	public List<Cgml> findList(){
		return dao.findList(new Cgml());
	}
	
	@Transactional(readOnly = true)
	public List<Cgml> findList(Cgml cgml){
		if(cgml != null){
			cgml.setParentIds(cgml.getParentIds() + "%");
			return dao.findByParentIdsLike(cgml);
		}
		return  new ArrayList<Cgml>();
	}
	
	@Transactional(readOnly = false)
	public void save(Cgml cgml) {
		super.save(cgml);
	}
	
	@Transactional(readOnly = false)
	public void delete(Cgml cgml) {
		super.delete(cgml);
	}
	
}
